#include <bits/stdc++.h>
#define sc(x) scanf("%d", &(x))
#define pr(x) printf("%lld\n", (x))
#define rep(i, l, r) for (int i = l; i <= r; ++i)
using namespace std;
typedef long long ll;
const int N = 1e3 + 7;
const int mod = 1e9 + 7;
pair<int, int> a[1005];
pair<int, int> v[1005][2];
int d[1005];
int p = 0;
void add(const pair<int, int>& fa, const pair<int, int>& x, int dep = 1) {
    int idx = fa.first;
    bool r = fa.second < x.second;
    p = max(p, dep);
    if (v[idx][r].first == -1) {
        v[idx][r] = x;
        d[dep]++;
    } else
        add(v[idx][r], x, dep + 1);
}
void solve() {
    int n, x;
    cin >> n;
    if (n == 1) {
        cout << "1 + 0 = 1\n";
        exit(0);
    }
    rep(i, 0, n - 1) {
        cin >> x;
        a[i] = {i, x};
    }
    rep(i, 0, 1000) v[i][0].first = v[i][1].first = -1;
    pair<int, int> rt = a[0];
    rep(i, 1, n - 1) add(rt, a[i]);
    cout << d[p] << " + " << d[p - 1] << " = " << d[p] + d[p - 1] << '\n';
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}